package com.haier.npt.filter;

import javax.servlet.http.HttpServletRequest;

public class TokenUtil {

	public static String getRequestAccessToken(HttpServletRequest request){
		String access_token = request.getParameter("access_token");
		if(access_token == null){
			String authorization = request.getHeader("Authorization");
			if(authorization == null){
				return null;
			}
			authorization = authorization.toLowerCase();
			if(authorization.startsWith("bearer ")){
				access_token = authorization.substring("bearer ".length());
			}
		}
		return access_token;
	}
}
